<?php
/**
 * 商品评价管理控制器
 * @version 2015051010 
 * @author Justin <justin@jipu.com>
 */

namespace Shop\Controller;

class ItemCommentController extends CommonController{

  public function index(){
      $store_id = $_SESSION['jipushop_store']['seller_user']['store_id'];
      $where['store_id'] = $store_id;
      $where['pid'] = 0;
    ($item_id = I('get.item_id')) && $where['item_id'] = $item_id;
    parent::index($where);
  }
  
  /**
   * 商品评价回复
   * @author Justin <9801836@qq.com>
   */
  function reply(){
    $id = I('id');
    if($id){
      $this->data = M('ItemComment')->getById($id);
      //回复内容
      $this->data_reply = get_item_comment_reply($id);
      $this->display();
    } 
  }
  
  
  function update($model = CONTROLLER_NAME){
  	if(IS_POST){
  		$model = D($model);
  		if(false !== $model->update()){
  			$this->success('操作成功！', Cookie('__forward__'));
  		}else{
  			$error = $model->getError();
  			$this->error(empty($error) ? '未知错误！' : $error);
  		}
  	}else{
  		$this->redirect(U('index',array('item_id'=>I('item_id'))));
  	}
  }
}
